﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using DropBoxClient.Entities;

namespace DropBoxClient.Tests
{
    [TestClass]
    public class GetFileMetaTest
    {
        private string accessToken;
        private FileMeta fileMeta;

        [TestInitialize]
        public void Init()
        {
            accessToken = ConfigurationManager.AppSettings["AccessToken"];
            var client = new OAuth2Client(accessToken);
            fileMeta = client.GetFileMeta(StringConstants.SandboxRoot, "Test/Notes.txt");
        }

        [TestMethod]
        public void GetFileMeta_ResultIsNotNull()
        {
            Assert.IsNotNull(fileMeta);
        }

        [TestMethod]
        public void GetFileMeta_BytesIsGreaterThanZero()
        {
            Assert.IsTrue(fileMeta.Bytes > 0);
        }

        [TestMethod]
        public void GetFileMeta_IsAFile()
        {
            Assert.IsFalse(fileMeta.IsDirectory);
        }

        [TestMethod]
        public void GetFileMeta_ReturnsCorrectMimeType()
        {
            Assert.AreEqual("text/plain", fileMeta.MimeType);
        }
    }
}
